package com.example.sqlitedemo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MyDBOpenHelper extends SQLiteOpenHelper {
    public static final String DB_NAME="yly.db";
    public static  final int DB_VISION=1;
    public MyDBOpenHelper(Context context) {
        super(context,DB_NAME,null,DB_VISION);
    }
    //第一次创建数据库
    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        Log.d("sql","onCreate执行");
        sqLiteDatabase.execSQL("create table food(_id integer primary key autoincrement,foodname text,foodprice real,count integer)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        Log.d("sql","onUpgrade执行");
    }
}
